<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<title>首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />

<!-- easyui -->
<script type="text/javascript" th:src="@{/easyui/jquery.min.js}" ></script>
<script type="text/javascript" th:src="@{/easyui/jquery.easyui.min.js}"></script>
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/default/easyui.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/icon.css}">
<link rel="stylesheet" type="text/css" th:href="@{/easyui/themes/color.css}">
	<script type="text/javascript" th:src="@{/easyui/locale/easyui-lang-zh_CN.js}"></script>
	<style>
		*{
			text-align: center;
		}
		h2,#addForm{
			padding: 10px 20px;
		}
		#addForm>*{
			margin-top: 10px;
		}
		#addForm input{
			margin-left: 10px;
		}
	</style>
</head>
<body>
	<h2>教学实验申请</h2>
	<form id="addForm" method="post">
		课程编号：<input name="teNo" class="easyui-validatebox" data-options="required:true"/><br>
		<div th:if="${#strings.isEmpty(session.Id)}">申请人编号：<input name="teAId" class="easyui-validatebox" data-options="required:true" th:value="${session.Id}"/><br></div>
		实验标题:<input name="teTitle" class="easyui-validatebox" data-options="required:true"/><br>
		实验内容:<input name="teContent" class="easyui-validatebox" data-options="required:true"/><br>
		<div th:if="${#strings.isEmpty(session.userName)}">申请人姓名:<input name="teAName" class="easyui-validatebox" th:value="${session.userName}"/><br></div>
		实验室编号:<input name="labId" class="easyui-validatebox" /><br>
		日期:<input name="teDate" id="teDate" type="text" class="easyui-datebox" /><br>
		学院:<input name="teAcademy" class="easyui-validatebox" /><br>
		<a id="saveBtn" href="#" class="easyui-linkbutton">申请</a>
	</form>
	<script type="text/javascript" th:inline="none">
	$(function(){
		$.fn.datebox.defaults.formatter = function(date){
			var y = date.getFullYear();
			var m = date.getMonth()+1;
			var d = date.getDate();
			return m+'-'+d+'-'+y;
		}
		/*保存*/
		$("#saveBtn").click(function () {
			$("#addForm").form("submit",{
				url:"/tex/applyTex",     //提交表单
				onSubmit:function(){
					return $("#editForm").form("validate");
				},
				success:function(data){   //回传数据
					data=eval("("+data+")")
					if(data.success){
						$("#win").window("close");
						$("#list").datagrid("reload");
						$.messager.alert("提示","保存成功!","info");
					}else{
						$.messager.alert("提示","保存失败！",data.msg,"error");
					}
				}
			});
		})

	});
	</script>

</body>